jQuery(document).ready(function(){
        if(document.cookie == "" || document.cookie == undefined || document.cookie ==  null ){
            //alert("COOKIE isNull");
            jQuery(".btn-update,.btn-subscribe,.btn-comment").attr("disabled", true);
        }
        else{
            jQuery.ajax({
                scriptCharset: 'utf-8',
                type: "POST",
                url: "/validation_islogin",
                contentType:"application/json",
                data: JSON.stringify({
                    "phonenumber": document.cookie.split(';')[1].split('=')[1],
                    "uid": document.cookie.split(';')[0].split('=')[1]
                }),
                dataType: "json",
                success: function(success) {
                    //alert("Success sent data 10");
                    if (success.errorcode==0){
                        //jQuery(".btn-update,.btn-subscribe,.btn-comment").hide();
                        jQuery(".btn-update,.btn-subscribe,.btn-comment").attr("disabled", true);
                        //alert("Not login yet");
                        //alert("Disable all button");
                    }
                    else{
                        //jQuery(".btn-login,#register_id").hide();
                        jQuery(".btn-login").attr("disabled",true);
                        jQuery("#register_id").removeAttr("href");
                        //alert("disable login button and register tag");
                    }
                },
                error: function(error) {
                    //alert("keep original page");

                }
            });
        }
});
